UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ppnJtMNo0CHVmSUgrYBi7NsyGdcGrgELSRoyN5sHfYA='
WHERE
key_id = 'd49e47a16bb239eaf7bf70778f9bec7e14358c4fd1c8cf0db9a5d15ba64bc6d3'
AND (
token = 'ppnJtMNo0CHVmSUgrYBi7NsyGdcGrgELSRoyN5sHfYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)