UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '40F7UYR+9C/2b+5GnEBfyxqAEf5plP8t2IroIl0sJSk=' 
WHERE 
  key_id = 'f099f89d34f180faa918abe79544664c7530ce004cb735fced7585939ad9f741' 
  AND (
    token = '40F7UYR+9C/2b+5GnEBfyxqAEf5plP8t2IroIl0sJSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027