UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8oT1W9yDaEWab0UL6MuiIpa6BHxKO2fmDDQkGHfvzNY='
WHERE
key_id = '8c57bad3dc3690565a5c723a06d1171a0eeb07de3007cfc008f4f1bea8034b51'
AND (
token = '8oT1W9yDaEWab0UL6MuiIpa6BHxKO2fmDDQkGHfvzNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)