UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '87KWt/zJb0to6sP4EIs7CKBVcRMKysD9Zru2sWKN7N8=' 
WHERE 
  key_id = 'd2eb1cec778da4d0d2862ed5f7ab3127d2c93172121e14d1f960c0e02e4ecc97' 
  AND (
    token = '87KWt/zJb0to6sP4EIs7CKBVcRMKysD9Zru2sWKN7N8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060