UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dRuI0CsGFqYn3mBspRbIEOTrZVKqkp524z/QqtpdI+Y=' 
WHERE 
  key_id = '3add10f1a6f9a67698516f74fdaf34fcdf2161cd8ad6e60533b4027be1f15f01' 
  AND (
    token = 'dRuI0CsGFqYn3mBspRbIEOTrZVKqkp524z/QqtpdI+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028