UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'meF79M2/vSWruhcIxm5gD+sHnVJ0SMJNpNg4Z+v08HQ=' 
WHERE 
  key_id = '5c24c13a87305256933d9214f4e20f00bf3b6cb602afeb7fa1690fb63fa646de' 
  AND (
    token = 'meF79M2/vSWruhcIxm5gD+sHnVJ0SMJNpNg4Z+v08HQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034