UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yd0/71yGsZzW9ItILP7be4sIhJO7q4KwnVsPdeDid1s=' 
WHERE 
  key_id = '5667ba37944e0749cceac7c47515ea94000b0fed617f43a535cf127a6d060dc1' 
  AND (
    token = 'yd0/71yGsZzW9ItILP7be4sIhJO7q4KwnVsPdeDid1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023