UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VM+Y2LuCmCVC1CTnQv0UCJqwpDLeLTPS7zqweGgTNEo=' 
WHERE 
  key_id = '550aa4479b83b334e490d1c94805a6163738fd89bafbefa5c6264268a8ace525' 
  AND (
    token = 'VM+Y2LuCmCVC1CTnQv0UCJqwpDLeLTPS7zqweGgTNEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037