UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhBgbuEF0isiLET9yEoqx45/MP3YMVoqLoySckwq4dM=' 
WHERE 
  key_id = '0011d97e5a63deff40c7578d1589e375ef01cea64944c4e600b84aa1b313d557' 
  AND (
    token = 'hhBgbuEF0isiLET9yEoqx45/MP3YMVoqLoySckwq4dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029