UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T5MjCrdsB/ULNQtei15kAIwAyVnCRbAmg5Pz2BiQryI='
WHERE
key_id = 'f37b57409da788af84827ee24adab8c8fb737b1741f6bae6b5fde433fa2f50d4'
AND (
token = 'T5MjCrdsB/ULNQtei15kAIwAyVnCRbAmg5Pz2BiQryI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)