UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wnc9cYYPtN44LXqK49U/KSGmFruUOFF79o1NKkrf/oQ='
WHERE
key_id = 'a20b3014a195c7dac393f54e22a0ca80a0382748e465c3c192bd05824123ee59'
AND (
token = 'wnc9cYYPtN44LXqK49U/KSGmFruUOFF79o1NKkrf/oQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)