UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zpAZoulh2kgDq2QTuxT3+S8ES61FD84VpVqayUmq9Rs=' 
WHERE 
  key_id = '9382baadebea461d920c205410d5fa127741ae805c3e51d6114621222346ed16' 
  AND (
    token = 'zpAZoulh2kgDq2QTuxT3+S8ES61FD84VpVqayUmq9Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014