UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ydHHGDTKFTXRdEIPNs5RPU+yRnBwmAsXNps2HeJgMjA='
WHERE
key_id = 'ed06024ab2f214236f709df9cbd71d37e2ac54c67422c7837035e002f48b77dc'
AND (
token = 'ydHHGDTKFTXRdEIPNs5RPU+yRnBwmAsXNps2HeJgMjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)