UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H+uH6tgKDe2oqkae8hVfaOWhHyBDQxvHbNzzmew7D6o='
WHERE
key_id = '12debdf67783dcd415306b6d46a863d37b4914616fd6d74a96abe44d7174bb6b'
AND (
token = 'H+uH6tgKDe2oqkae8hVfaOWhHyBDQxvHbNzzmew7D6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)