UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8gXZTzEsjniUSUmpYpjQLmgtppvfDwnfCy0suHJ8IHY='
WHERE
key_id = 'cff7efa521916d4be911abb58a1bb494d48008585b9b0781f6d95f0758c8ceba'
AND (
token = '8gXZTzEsjniUSUmpYpjQLmgtppvfDwnfCy0suHJ8IHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)