UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9nFp5TvM5GtvxQJj6xcjNtnkLv4Jb0ZagwAshf3PuCQ='
WHERE
key_id = 'ca589d777562e62d6545d01b3d1b04f2ed04a6d8d744df28832e3467e8ff784a'
AND (
token = '9nFp5TvM5GtvxQJj6xcjNtnkLv4Jb0ZagwAshf3PuCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)