UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sNr/7XEgh6nm4kBF8Cf4wmot0OXOWMDgFnchCBk0irY='
WHERE
key_id = '17d8af8eac341675472cd6cfae70441997867bfc92f9471272cbf16bde48b365'
AND (
token = 'sNr/7XEgh6nm4kBF8Cf4wmot0OXOWMDgFnchCBk0irY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)