UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lZ5xk/5NFtQffltWzSlSypFp2u7Nx4sQRMW8rh1mkk0='
WHERE
key_id = '5d91722093f862f5bd51a978889dbeff143078a6cecd24d1a70aedc16f0763ee'
AND (
token = 'lZ5xk/5NFtQffltWzSlSypFp2u7Nx4sQRMW8rh1mkk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)