UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pQr+sm5xPNGU55e+n9ZoAtXD+G+WgJH7cR2e15rfJ1U='
WHERE
key_id = 'c378a397608ceb24539e3a03bc85b4e76062d481675c95d937f515b385d5808f'
AND (
token = 'pQr+sm5xPNGU55e+n9ZoAtXD+G+WgJH7cR2e15rfJ1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)