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