UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ccn4d4Qpu8RzKZIQ+3ay+pItQYZbHpnPpESATgwuoYQ=' 
WHERE 
  key_id = '3b502e62802c2afd0f50d6aa5cc5a7f85ff7095783c7874468615606096f7445' 
  AND (
    token = 'Ccn4d4Qpu8RzKZIQ+3ay+pItQYZbHpnPpESATgwuoYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019