UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CgKdKFxBBQq3h+/R9ZRQyvG/+yiLMgEGrqTxZz+N5Do='
WHERE
key_id = 'a8dcbf487ce0a884e1f6579b5f893153167692ac557b91cb332471b3e628da62'
AND (
token = 'CgKdKFxBBQq3h+/R9ZRQyvG/+yiLMgEGrqTxZz+N5Do='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)