UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sp8n2cOY6mNfacMj7HoSS7iH0FaQD2T0SHraIRWz2Wg=' 
WHERE 
  key_id = '86c2cf748cb14e6770110c315a2f95ca85d53cb79b320f1726c3afad9c36cf16' 
  AND (
    token = 'Sp8n2cOY6mNfacMj7HoSS7iH0FaQD2T0SHraIRWz2Wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032