UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tj5MF0N0wgXGEZrTtF+ymYjGYv6zDeVdh3Xkrp5G85o='
WHERE
key_id = '1e96a81b3760284ebdf2f1e0dcd8a3c486375a060a23631c5a1c513b4b863cd8'
AND (
token = 'tj5MF0N0wgXGEZrTtF+ymYjGYv6zDeVdh3Xkrp5G85o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)