UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mQvumbjBBtp3FkRXgeoOkDgHezhGtxdzYXsDJ+9G+NE=' 
WHERE 
  key_id = '571c47608782cdbfef616bdd00695b3dcc472b55054724a88d3624e263f44555' 
  AND (
    token = 'mQvumbjBBtp3FkRXgeoOkDgHezhGtxdzYXsDJ+9G+NE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030