UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xLTwKvTUWdmi8AmXp3/NhgRpWjdLbFJnDiJORDDxJ94='
WHERE
key_id = 'd2864b64f2a019638dabc4e39063e535c38c7aaf64213f34ce4142d7028a0816'
AND (
token = 'xLTwKvTUWdmi8AmXp3/NhgRpWjdLbFJnDiJORDDxJ94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)