UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kdCtc0GGKmIJ3akCs/zimSptPW/7bVNxp0139OCQ/9k='
WHERE
key_id = 'd3b81c11e93a349f0033e9940604c0a3f57162e040ebfe5360d747088c521f0f'
AND (
token = 'kdCtc0GGKmIJ3akCs/zimSptPW/7bVNxp0139OCQ/9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)