UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tw9EnSSaHTHvuc5XH595jh97qcWepVQs1AqlDQMypCY='
WHERE
key_id = 'ce4fc58f34555c879f4ba4a8c2928f3249430131552ed80a7c68fa0b37890e69'
AND (
token = 'Tw9EnSSaHTHvuc5XH595jh97qcWepVQs1AqlDQMypCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)