UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fwdqCodmSOn+h/+hWUBLD6psdhxtHmkoea3FtmHygvU=' 
WHERE 
  key_id = '3bced6008a7ced12adbabe18aadb704d4e717b6a3d4baabb6432b584ef9d7c2c' 
  AND (
    token = 'fwdqCodmSOn+h/+hWUBLD6psdhxtHmkoea3FtmHygvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043