UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kepcFYzoI12xVVj8hSnxiHhZ9uwN5DATIEcCRxXcFEA=' 
WHERE 
  key_id = 'a25e29b90fcb268df460162d5f7880abf6375f903bc22faa6804e94128db5bb5' 
  AND (
    token = 'kepcFYzoI12xVVj8hSnxiHhZ9uwN5DATIEcCRxXcFEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00101