UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gqUDr+0aIPt+WS2tWgwsO8U4ex7bO6iK/KhAQB8DF2s=' 
WHERE 
  key_id = '1d51e4110724a7b87a2af8119ce30ddfa79395ca4c8202eb54e5d061fb267907' 
  AND (
    token = 'gqUDr+0aIPt+WS2tWgwsO8U4ex7bO6iK/KhAQB8DF2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050