UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5g+ZLj5MqGoYX8JJE9Kx1mjSbHdh7I1r2WKOLU44yvQ=' 
WHERE 
  key_id = 'de0a38ea34debdb56a3efbacc767e703b801d6c2c2c3058b87d4be1ff05b7d0c' 
  AND (
    token = '5g+ZLj5MqGoYX8JJE9Kx1mjSbHdh7I1r2WKOLU44yvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047