UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NT98fjbHPlAmH38kWbB1V1sgmvPyxPiolaZSmX9THhA='
WHERE
key_id = '347342d374ccf984120ec2fd35c8079b5d90035789aaaa6a682aaac2d7510704'
AND (
token = 'NT98fjbHPlAmH38kWbB1V1sgmvPyxPiolaZSmX9THhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)