UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ftmYIo0mYi3D6X4wi0Yvyl1airLWmDCIpaT/icm4Xs='
WHERE
key_id = '8e10f125fc0d583ebc6e134a720f468c7e8343b4627af36c124be252db2a2e26'
AND (
token = '7ftmYIo0mYi3D6X4wi0Yvyl1airLWmDCIpaT/icm4Xs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)