UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EioBXIEE0dUZhmiJKu9Na2L+v81DtcCpjcWSyex1Gm8='
WHERE
key_id = 'ac0ecd700e5648b666d9621ae6a1662cb93d49f180c04dcc514258dcadd758bc'
AND (
token = 'EioBXIEE0dUZhmiJKu9Na2L+v81DtcCpjcWSyex1Gm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)