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