UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMwqy6NNG4DH9oKfavh91WFdpr9B8JA3zt4Y2cNGdCA=' 
WHERE 
  key_id = '76ec735a1696b806f6242d4554a5f2eadf8b47b6ad401fc5ee18b3af1d1bbd17' 
  AND (
    token = 'KMwqy6NNG4DH9oKfavh91WFdpr9B8JA3zt4Y2cNGdCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025