UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TQ7Gkeyvlh45L/hqDYdksoCsEFkbQ2eu3S139Xzf2lE='
WHERE
key_id = 'e456712e2df8498c0775896d19151638b56253e1ea3948eae2734c8f56a7874c'
AND (
token = 'TQ7Gkeyvlh45L/hqDYdksoCsEFkbQ2eu3S139Xzf2lE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)