UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X7G8lt+rqkIHAxhR4M+ThH0AVZcn+8doBxut8re0mMk='
WHERE
key_id = '2f575909d200af2d9aba70ccc38c4bfd9df49834baf493a803fb63e76b3136bc'
AND (
token = 'X7G8lt+rqkIHAxhR4M+ThH0AVZcn+8doBxut8re0mMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)