UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yBLbeIBZd9L+mRv+qHuFuxRPVTE3tJkvROWg4aTHA6Y='
WHERE
key_id = '847fd2e0aa6f18e03f2f3e681fb9408d183c6f95aa0d487a5e8390640b01fc88'
AND (
token = 'yBLbeIBZd9L+mRv+qHuFuxRPVTE3tJkvROWg4aTHA6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)