UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jEi58W0gGTFzBeabRSIoKn1rgwIAM/84tWOvAZPorRQ='
WHERE
key_id = 'a40228ba63fe928bc0ca9d40960b35e09dd0c168f19bf7a74d34632f100f5969'
AND (
token = 'jEi58W0gGTFzBeabRSIoKn1rgwIAM/84tWOvAZPorRQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)