UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd4xjZf1jIHhaUBhYC/mUUY6xKIeTAgtXc3uXEGRKxxE='
WHERE
key_id = '59f2f49e42a9fa05839d08597ce39cfa18a9a9db2169e2ce0360d079b560c682'
AND (
token = 'd4xjZf1jIHhaUBhYC/mUUY6xKIeTAgtXc3uXEGRKxxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)